# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=('yasm' 'yasm-devel')
pkgver=1.3.0
pkgrel=2
pkgdesc="A rewrite of NASM to allow for multiple syntax supported (NASM, TASM, GAS, etc.)"
arch=('i686' 'x86_64')
url="http://www.tortall.net/projects/yasm/"
license=('BSD' 'GPL2' 'LGPL2.1' 'PerlArtistic')
options=('staticlibs')
source=(http://www.tortall.net/projects/yasm/releases/${pkgname}-${pkgver}.tar.gz
        'msysize.patch'
        'yasm-1.2.0-1.src.patch')
sha1sums=('b7574e9f0826bedef975d64d3825f75fbaeef55e'
          '11548c2ec879f6c026e01d8e0fc230fb14d65a8a'
          '5a7dae77b2a1230e1d3a1123fcf63633d756c4d7')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/msysize.patch
  patch -p2 -i ${srcdir}/yasm-1.2.0-1.src.patch

  autoreconf -fi
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --build=${CHOST}
  make
  make DESTDIR="${srcdir}/dest" install
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package_yasm() {
  mkdir -p ${pkgdir}/usr

  cp -rf ${srcdir}/dest/usr/bin ${pkgdir}/usr/
  cp -rf ${srcdir}/dest/usr/share ${pkgdir}/usr/
}

package_yasm-devel() {
  mkdir -p ${pkgdir}/usr

  cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
  cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
}
